import { defineStore } from "pinia"
import { ToastOption } from '@/types'
interface Props {
  msg: string,
  type: string,
  show: boolean,
  duration: number
}
const toastStore = defineStore("toast",{
  state():Props {
    return {
      msg: 'toast',
      type: 'text',
      show: false,
      duration: 2000
    }
  },
  getters:{
    options(state) {
      return state;
    }
  },
  actions:{
    setToast (state, option:ToastOption) {
      state.msg = option.msg
      state.type = option.type
      state.show = option.show
      state.duration = option.duration
    }
  }
})
export default toastStore
